<%@include file="header.jsp"%>

<div class="tabela">
<s:actionmessage/>
<h2><s:text name="Album" /> <s:property value="nomeAlbum"
	escapeHtml="false" /></h2>
<h2><s:text name="Musicas" /></h2>
<table id="myTable" class="tablesorter">
	<thead>
		<tr>
			<th><s:text name="Nome" /></th>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="#request.musicas">
			<tr>
				<td><s:property escapeHtml="false" value="nome" /></td>
			</tr>
		</s:iterator>
	</tbody>
</table>

<div id="pager" class="pager">
<form><img src="<s:url value="/img/first.png"/>" class="first" />
<img src="<s:url value="/img/prev.png"/>" class="prev" /> <input
	type="text" class="pagedisplay" /> <img
	src="<s:url value="/img/next.png"/>" class="next" /> <img
	src="<s:url value="/img/last.png"/>" class="last" /> 
	<select	class="pagesize">
	<option value="10">10</option>
	<option value="20">20</option>
	<option selected="selected" value="25">25</option>
	<option value="30">30</option>
	<option value="40">40</option>
</select></form>
</div>
</div>

<div class="tabela" style="padding-top: 40px;">
<h2><s:text name="Comentarios" /></h2>
<s:if test="#session.userId != null">
<s:form action="adicionarComentario" includeContext="true" namespace="/album">
	<s:hidden name="idAlbum"></s:hidden>
	<s:textarea name="comentario" disabled="false" value=""/>
	<s:submit key="adicionarComentario" />
</s:form>
</s:if>
<s:else>
<h2><s:text name="mensagem.logado.comentar" /></h2>
</s:else>
<s:if test="#request.comentarios">
	
	<table id="myTable2" class="tablesorter">
		<thead>
			<tr>
				<th><s:text name="Comentario" /></th>
				<th><s:text name="Data" /></th>
				<th><s:text name="Usuario" /></th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="#request.comentarios">
				<tr>
					<td><s:property escapeHtml="false" value="comentario" /></td>

					<td><s:property escapeHtml="false" value="data" /></td>

					<td><s:property escapeHtml="false" value="usuario.nome" /></td>
				</tr>
			</s:iterator>
		</tbody>
	</table>

	<div id="pager2" class="pager">
	<form><img src="<s:url value="/img/first.png"/>" class="first" />
	<img src="<s:url value="/img/prev.png"/>" class="prev" /> <input
		type="text" class="pagedisplay" /> <img
		src="<s:url value="/img/next.png"/>" class="next" /> <img
		src="<s:url value="/img/last.png"/>" class="last" /> 
		<select	class="pagesize">
		<option selected="selected" value="10">10</option>
		<option value="20">20</option>
		<option value="25">25</option>
		<option value="30">30</option>
		<option value="40">40</option>
	</select></form>
	</div>

	<script type="text/javascript">
	$(document).ready(function() {
		$("#myTable2").tablesorter( {
			widthFixed : true,
			widgets : [ 'zebra' ]
		}).tablesorterPager( {
			container : $("#pager2"),
			size: 10
		});
	});
</script>
</s:if> <s:else>
	<h3><s:text name="mensagem.nao.existem.comentarios.album" /></h3>
</s:else>
</div>
<div class="tabela" style="padding-right: 0px; float: right;">
<h2><s:text name="Ofertas.venda" /></h2>
<s:if test="#request.ofertasVenda">
	<table id="myTable3" class="tablesorter">
		<thead>
			<tr>
				<th><s:text name="Preco.inicial" /></th>
				<th><s:text name="Data.vencimento" /></th>
				<s:if test="#session.userId != null">
				<th></th>
				</s:if>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="#request.ofertasVenda">
				<tr>
					<td><s:property escapeHtml="false" value="precoInicial" /></td>

					<td><s:property escapeHtml="false" value="dataFim" /></td>
					<s:if test="#session.userId != null">
						<td><s:a action="adicionarOfertaCompra" namespace="/album">
						<s:param name="idOfertaVenda" value="id" />
						<s:param name="nomeAlbum" value="nomeAlbum" />
						<s:param name="idAlbum" value="idAlbum" />
						<s:text name="Comprar" />
						</s:a>
						</td>
					</s:if>	
				</tr>
			</s:iterator>
		</tbody>
	</table>

	<div id="pager3" class="pager">
	<form><img src="<s:url value="/img/first.png"/>" class="first" />
	<img src="<s:url value="/img/prev.png"/>" class="prev" /> <input
		type="text" class="pagedisplay" /> <img
		src="<s:url value="/img/next.png"/>" class="next" /> <img
		src="<s:url value="/img/last.png"/>" class="last" /> 
		<select	class="pagesize">
		<option selected="selected" value="10">10</option>
		<option value="20">20</option>
		<option value="25">25</option>
		<option value="30">30</option>
		<option value="40">40</option>
	</select></form>
	</div>

	<script type="text/javascript">
	$(document).ready(function() {
		$("#myTable3").tablesorter( {
			widthFixed : true,
			widgets : [ 'zebra' ]
		}).tablesorterPager( {
			container : $("#pager3"),
			size: 10
		});
	});
</script>
</s:if> <s:else>
	<h3><s:text name="mensagem.nao.existem.ofertas.venda.album" /></h3>
</s:else>
<s:url id="adicionarOfertaVenda" action="adicionarOfertaVenda" escapeAmp="false">
	<s:param name="idAlbum"><s:property value="idAlbum" /></s:param>
	<s:param name="nomeAlbum"><s:property value="nomeAlbum" /></s:param>
</s:url>

	  <a href="<s:property value="adicionarOfertaVenda"/>">Adicionar Oferta de Venda</a>

</div>
<%@include file="footer.jsp"%>